package com.flycent.hqhs.ui;

import net.tsz.afinal.FinalActivity;
import net.tsz.afinal.annotation.view.ViewInject;

import com.flycent.hqhs.App;
import com.flycent.hqhs.R;
import com.flycent.hqhs.ui.view.SimpleTitleBar;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

/**
 *  提交订单成功
 * 
 * @author fbl
 *
 */
public class SubmitOrderSuccessActivity extends BackableTitleBarActivity{
	@ViewInject(id = R.id.order_no_text) TextView mOrderNoText;
	@ViewInject(id = R.id.order_price_text) TextView mOrderPriceText;
	@ViewInject(id = R.id.order_status_text) TextView mOrderStatusText;
	@ViewInject(id = R.id.see_the_order_but,click = "butClick") Button mSureBut;

	private long sn;
	private String mOrderStatus = "";
	private float mOrderPrice;
	@Override
	protected void onCreate(Bundle savedInstance) {
		super.onCreate(savedInstance);
		sn = getIntent().getLongExtra("sn", 0);
		mOrderStatus = getIntent().getStringExtra("orderStatus");
		mOrderPrice = getIntent().getFloatExtra("orderPrice", 0);

		setContentView(R.layout.activity_submit_order_success);
		FinalActivity.initInjectedView(this);
		getTitleBar().setTitle(R.string.title_submit_success);

		mOrderNoText.setText(sn+"");
		mOrderPriceText.setText(mOrderPrice+"元");
		mOrderStatusText.setText(mOrderStatus.equals("unconfirmed")? "未付款":"已付款" );
		
	}
	public void butClick(View v){
		if(v == mSureBut ){
			Intent intent = new Intent(SubmitOrderSuccessActivity.this,OrderDetailActivity.class);
			intent.putExtra("sn", sn+"");
			startActivity(intent);

		}
	}
	@Override
	protected void onTitleBarCreated(SimpleTitleBar titleBar) {
		super.onTitleBarCreated(titleBar);
		if("unconfirmed".equals(mOrderStatus) ){
			titleBar.setRightButtonText("去付款");
			titleBar.setOnRightButtonClickListener(new OnClickListener() {
				@Override
				public void onClick(View paramView) {
					App.showShortToast("去付款");
				}
			});
		}
	}


}
